<template>
    <div>
        <el-dialog title="合同详情" :visible.sync="isShow" width="800px" @close="cancel" v-dialogDrag
                   append-to-body>
            <el-table :data="tableData" :header-cell-style="{background:'#eef1f6',color:'#606266'}">
                <el-table-column label="合同编号" show-overflow-tooltip>
                    <template slot-scope="scope">
                        {{scope.row.code}}
                    </template>
                </el-table-column>
                <el-table-column label="合同名称">
                    <template slot-scope="scope">{{scope.row.name}}</template>
                </el-table-column>
                <el-table-column label="项目负责人">
                    <template slot-scope="scope">{{scope.row.person}}</template>
                </el-table-column>
                <el-table-column label="合同内容">
                    <template slot-scope="scope">{{scope.row.content}}</template>
                </el-table-column>
                <el-table-column label="合同有效期" >
                    <template slot-scope="scope">{{scope.row.beginTime | dateFormat}} - {{scope.row.endTime | dateFormat}}</template>
                </el-table-column>
                <el-table-column label="合同金额">
                    <template slot-scope="scope">{{scope.row.price}}</template>
                </el-table-column>
            </el-table>

            <span slot="footer" class="dialog-footer">
                <el-button class="font12" @click="cancel" size="small">返 回</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
export default {
    props: ['message'],
    data() {
        return {
            isShow: false,
            tableData: [],
            contract: {}
        };
    },
    created() {
    },
    watch: {
        message (newV, oldV) {
            this.tableData[0] = newV.data
        },
        deep:true  
    },
    methods: {
        show() {
            this.isShow = true;
        },
        hide() {
            this.isShow = false;
        },
        cancel() {
            this.hide();
        },
    },
    filters: {
    dateFormat (val) {
      if (val == null || val == '') {
        return ''
      } else {
        let d = new Date(val)
        let month = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1
        let day = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()
        let times = d.getFullYear() + '/' + month + '/' + day
        return times
      }
    }
  }
};
</script>
<style>
</style>